#include <Windows.h>
#include "../Lib/gamegatebus.h"
#include "../Common/common.h"


int main(int argc, char *argv[])
{
	if(!CGameGateBus::instance().OpenBus())
		return false;

	
	while(true)
	{
		char buf[CLIENT_BUF_MAX]={0};
		unsigned int nlen = 0;
		CGameGateBus::instance().RecvFromGate(buf, sizeof(buf), nlen);
		if (nlen != 0)
		{
			AppHead *head = reinterpret_cast<AppHead *>(buf);
			printf("%d %d %d %d %s\n",head->len,head->uin,head->pos,head->cmd,buf+sizeof(AppHead));
			CGameGateBus::instance().SendToGate(buf, nlen);
		}
		else
			Sleep(10);
	}

	return 0;
};